package crivia.eca.carry;

import crivia.eca.i.HTMLForm;
import crivia.txt.common.Text;

public class Script implements HTMLForm {
	
	private String nodeID;
	
	private String nodeName;
	
	private String script;

	public String getNodeID() {
		return nodeID;
	}

	public void setNodeID(String nodeID) {
		this.nodeID = nodeID;
	}

	public String getNodeName() {
		return nodeName;
	}

	public void setNodeName(String nodeName) {
		this.nodeName = nodeName;
	}

	@Override
	public String getScript() {
		return script;
	}

	public void setScript(String script) {
		this.script = script;
	}

	public Script(String nodeID, String nodeName, String script) {
		super();
		this.nodeID = nodeID;
		this.nodeName = nodeName;
		this.script = script;
	}

	@Deprecated
	public Script(String nodeName, String script) {
		super();
		this.nodeName = nodeName;
		this.script = script;
	}

	public Script(int nodeID, String script) {
		super();
		this.nodeID = nodeID + "";
		this.script = script;
	}

	public Script() {
		super();
	}

	@Override
	public Class<?> getType() {
		return this.getClass();
	}
	
	public static Script fromFile(String nodeID, String Text){
		return new Script(Integer.parseInt(nodeID), Text);
	}
	
	public static Script fromFile(String nodeID, String fileName, String _package){
		return new Script(Integer.parseInt(nodeID), Text.get(_package, fileName));
	}

	public static Script fromFile(String nodeID, String fileName, Class<?> c){
		return new Script(Integer.parseInt(nodeID), Text.get(c, fileName));
	}

}
